import pandas as pd


def find_missing_numbers():
    # 读取Excel文件
    excel_path = '/Users/ricochen/program/base_station/test/template/仪器设备使用记录.xlsx'
    try:
        df = pd.read_excel(excel_path)
    except FileNotFoundError:
        raise FileNotFoundError(f"文件未找到: {excel_path}")
    
    # 提取序号列并转换为整数集合
    if '序号' not in df.columns:
        raise ValueError("Excel文件中未找到'序号'列")
    
    existing_numbers = set(df['序号'].dropna().astype(int))
    
    # 生成1到1980的完整序列
    all_numbers = set(range(1, 1981))
    
    # 找出缺失的数字并排序
    missing_numbers = sorted(all_numbers - existing_numbers)
    
    return missing_numbers


if __name__ == "__main__":
    try:
        missing = find_missing_numbers()
        print("缺失的序号列表:")
        print(missing)
    except Exception as e:
        print(f"发生错误: {str(e)}")